﻿$(document).ready(function() {
    var currentURL = document.URL.substring(document.URL.indexOf("/", 10));
    window.setInterval(function() {
        $.ajax({
            type: 'POST',
            url: "/Poll/GetPageInstruction",
            data: { pollID: $('#pollID').val() },
            success: function(response) {
                if (webURL) {
                    if (currentURL != response.NextWebURL && response.NextWebURL != null) {
                        window.location.href = response.NextWebURL;
                    }
                }
                else {
                    if (currentURL != response.NextScreenURL && response.NextScreenURL != null) {
                        window.location.href = response.NextScreenURL;
                    }
                }
            }
        });
    }, 2000);
});